<?php
if(isset($_SESSION['auth']['group'])) 
{
     $group = $_SESSION['auth']['group'];
}
else
{
     $group = 0;
};
$article_array = dibi::fetch("SELECT * FROM `articles` WHERE id=%i",$_GET['id']);	//Loading article from DB by ID
$row = count($article_array);				//Checking that article exist

	if($row && (time() >= $article_array['publication_date']))
	{
	    $rights = dibi::fetch("SELECT * FROM [rights] WHERE `group_id`=%i",$group," AND `category` = %i",$article_array['category']);
	    if(@$rights->right == 1)
	    {
	         echo '<table border="1">';
	         echo "<tr><td>ID</td><td>" . $article_array["id"] . "</td></tr>";
	         echo "<tr><td>NAME</td><td>" . $article_array["name"] . "</td></tr>";
	         echo "<tr><td>SHORTCONTENT</td><td>" . $article_array["shortcontent"] . "</td></tr>";
	         echo "<tr><td>CONTENT</td><td>" . $article_array["content"] . "</td></tr>";
	         echo "<tr><td>AUTHOR(id)</td><td>" . $article_array["author"] . "</td></tr>";
	         echo "<tr><td>CATEGORY(id)</td><td>" . $article_array["category"] . "</td></tr>";
	         echo "</table>";
	    }
	    else
	    {
	        echo $lang['article_acces_not_allowed']; 
	    };
     
     }
	else
	{
	    echo $lang['article_not_found'];
	};
?>
